/*******************************************************************************

  Paying Outsourced Labor: Direct Evidence from Linked Temp Agency-Worker-Client Data

  By Andres Drenik, Simon Jäger, Pascuel Plotkin and Benjamin Schoefer
	January 7th, 2021
	
	DESCRIPTION: Runs the Mincer Equation Regressions and Generates the Outputs
	for Table 1.

*******************************************************************************/




/********************************************************************************
***** Preliminaries
********************************************************************************/
set more off
cap log close
local curr_date = c(current_date)
log using "${logs}/10_Mincer_Equations`curr_date'", replace


/****************************************************************************************
* Load Dataset
****************************************************************************************/

use "${intermediate_data_emp}/dataset_AKM_estimation.dta", clear

/****************************************************************************************
* Mincer Equation Estimations
****************************************************************************************/

	keep log_real_wage temp_worker cuil_trab ciiu_4_user gender year age age_cuadratic age_cubic real_firm

	gen ind_year = ciiu_4_user*10^3 + (year - 2000)
	gen female = gender == 2

	*Specification (1):
	reghdfe log_real_wage temp_worker, absorb(year) vce(cluster cuil_trab) compact poolsize(10)
	outreg2 using "${Results}\mincer_1", replace tex

	*Specification (2):
	reghdfe log_real_wage temp_worker age age_cuadratic age_cubic female, absorb(year) vce(cluster cuil_trab) compact poolsize(10)
	outreg2 using "${Results}\mincer_2", replace tex

	*Specification (3):
	reghdfe log_real_wage temp_worker age age_cuadratic age_cubic female, absorb(ciiu_4_user year) vce(cluster cuil_trab) compact poolsize(10)
	outreg2 using "${Results}\mincer_3", replace tex

	*Specification (4):
	reghdfe log_real_wage temp_worker age age_cuadratic age_cubic female, absorb(year ciiu_4_user ind_year) vce(cluster cuil_trab) compact poolsize(10)
	outreg2 using "${Results}\mincer_4", replace tex
	
	*Specification (5):
	reghdfe log_real_wage temp_worker age age_cuadratic age_cubic, absorb(cuil_trab ciiu_4_user year) vce(cluster cuil_trab) compact poolsize(10)
	outreg2 using "${Results}\mincer_5", replace tex

	*Specification (6):
	reghdfe log_real_wage temp_worker age age_cuadratic age_cubic, absorb(cuil_trab real_firm year) vce(cluster cuil_trab) compact poolsize(10)
	outreg2 using "${Results}\mincer_6", replace tex

log close
